pp108 : getItem Method

getItem Method


This method searches for the specified item in the tree and returns the first item found.

Syntax


otreeItem = treeID.getItem(sText [, bInSensitive])

When called from a node other than root, the syntax is as follows:

treeNode.getItem(sText [, bInSensitive])

Parameters

Parameter

Description

sText

Required. String that specifies the description of the item to be search in the tree.

bInSensitive

Optional. Boolean that specifies whether the search is case-sensitive or not.

  • true - Search is case-insensitive.
  • false - (Default) Search is case sensitive.


Return Value


Returns the first item found. If the particular item is not found, it returns NULL.

Example


The following example shows how the above defined method is used.

//Function called to search the item "Favorites" in the tree "sampleTree"
var item = sampleTree.getItem("Favorites", true);
//If item is not found alert error, else display the data contained in it
if (item)
{
    application.notify("item :\n\n" + cordys.getXML(item.data));
}
else
{
    application.notify("Error ! Item not found !");
}
//Function called from a selected node in the sampleTree to search the item "Favorites"
var item = sampleTree.getSelectedItem().getItem("Favorites", false);
//If item is not found alert error, else display the data contained in it
if (item)
{
    application.notify("item :\n\n" + cordys.getXML(item.data));
}
else
{
    application.notify("Error ! Item not found !");
}

See Also

tree